! COSA.Request
{anchor:tbl_contents_0}
!! Classes
* [AddListMembersList|#msg_addlistmemberslist_0]
* [AddMemberList|#msg_addmemberlist_0]
* [Assign|#msg_assign_0]
* [Associate|#msg_associate_0]
* [CopyMembersList|#msg_copymemberslist_0]
* [Create|#msg_create_0]
* [Delete|#msg_delete_0]
* [Disassociate|#msg_disassociate_0]
* [ExecuteMultiple|#msg_executemultiple_0]
* [ExecuteWorkflow|#msg_executeworkflow_0]
* [LoseOpportunity|#msg_loseopportunity_0]
* [QualifyLead|#msg_qualifylead_0]
* [RemoveMemberList|#msg_removememberlist_0]
* [Retrieve|#msg_retrieve_0]
* [RetrieveAllEntities|#msg_retrieveallentities_0]
* [RetrieveAttribute|#msg_retrieveattribute_0]
* [RetrieveEntity|#msg_retrieveentity_0]
* [RetrieveMetadataChanges|#msg_retrievemetadatachanges_0]
* [RetrieveMultiple|#msg_retrieveMultiple_0]
* [RetrievePrincipalAccess|#msg_retrieveprincipalaccess_0]
* [RetrieveUserPrivileges|#msg_retrieveuserprivileges_0]
* [SetState|#msg_setstate_0]
* [Update|#msg_update_0]
* [WinOpportunity|#msg_winopportunity_0]
{anchor:msg_addlistmemberslist_0}
!! AddListMembersList message
!!! Constructor
!!!! new COSA.Request.AddListMembersList(listId, memberIds, requestId)
|| Param || Type || Description ||
| listId | {{string}} | List unique identifier (GUID) |
| memberIds | {{Array.<string>}} | Members unique identifiers (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| listId | {{string}} | List unique identifier (GUID) |
| memberIds | {{Array.<string>}} | Members unique identifiers (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var addListMemberList_0 = new COSA.Request.AddListMembersList(
        'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
        ['XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX']
    );

//message execution
addListMembersList_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(addListMembersList_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_addmemberlist_0}
!! AddMemberList message
!!! Constructor
!!!! new COSA.Request.AddMemberList(listId, entityId, requestId)
|| Param || Type || Description ||
| listId | {{string}} | List unique identifier (GUID) |
| entityId | {{string}} | Entity unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| listId | {{string}} | List unique identifier (GUID) |
| entityId | {{string}} | Entity unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var addMemberList_0 = new COSA.Request.AddMemberList(
        'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
        'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
    );

//message execution
addListMember_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(addListMember_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_assign_0}
!! Assign message
!!! Constructor
!!!! new COSA.Request.Assign(target, asignee, requestId)
|| Param || Type || Description ||
| target | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Target |
| assignee | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Assignee |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Instance Properties
|| Name || Type || Description ||
| target | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Target |
| assignee | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Assignee |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var assign_0 = new COSA.Request.Assign(new COSA.EntityReference('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'),
        							   new COSA.EntityReference('systemuser', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'));
//message execution
assign_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Core.Execute(assign_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_associate_0}
!! Associate message
Associate message
!!! Constructor
!!!! new COSA.Request.Associate(relationshipSchemaName, target, relatedEntities, requestId)
|| Param || Type || Description ||
| relationshipSchemaName | {{string}} | Relationship Schema Name |
| target | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Target |
| relatedEntities | Array.<[COSA.EntityReference|COSA Namespace#lib_entityreference_0]> | Related Entities Collection |
| requestId _*(optional)*_ | {{string}} | Request unique identifier (GUID) |
!!! Instance Properties
|| Name || Type || Description ||
| relationshipSchemaName | {{string}} | Relationship Schema Name |
| target | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Target |
| relatedEntities | Array.<[COSA.EntityReference|COSA Namespace#lib_entityreference_0]> | Related Entities |
!!! Example
{code:javascript}
var associate_0 = new COSA.Request.Associate('contactleads_association',
        new COSA.EntityReference('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'),
        [
            new COSA.EntityReference('lead', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'),
            new COSA.EntityReference('lead', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
        ]
    );
//message execution
associate_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Core.Execute(associate_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_copymemberslist_0}
!! CopyMembersList message
!!! Constructor
!!!! new COSA.Request.CopyMembersList(sourceListId, targetListId, requestId)
|| Param || Type || Description ||
| sourceListId | {{string}} | Source List unique identifier (GUID) |
| targetListId | {{string}} | Target List unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| sourceListId | {{string}} | Source List unique identifier (GUID) |
| targetListId | {{string}} | Target List unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var copyMembersList_0 = new COSA.Request.CopyMembersList(
        'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
        'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
    );

//message execution
copyMembersList_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(copyMembersList_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_create_0}
!! Create message
Create message
!!! Constructor
!!!! new COSA.Request.Create(entity, requestId)
|| Param || Type || Description ||
| entity | [COSA.BusinessEntity|COSA Namespace#lib_businessentity_0] | Entity to create |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Instance Properties
|| Param || Type || Description ||
| entity |[COSA.BusinessEntity|COSA Namespace#lib_businessentity_0] | Entity to update |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var name = COSA.Util.formatString('#{0}', (new Date()).getMilliseconds()),
    contact_0 = new COSA.BusinessEntity('contact', null, {
        lastname: new COSA.XrmString(name),
        emailaddress1: new COSA.XrmString(COSA.Util.formatString('{0}@mail.com', name)),
        creditlimit: new COSA.XrmMoney(100.50),
        numberofchildren: new COSA.XrmWholeNumber(2),
        creditonhold: new COSA.XrmBoolean(true),
        parentcustomerid: new COSA.EntityReference('account', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'),
        gendercode: new COSA.OptionSetValue(1),
        birthdate: new COSA.XrmDateTime(new Date()),
        address1_latitude: new COSA.XrmDouble(14.55)
    });

//message execution
(new COSA.Request.Create(contact_0)).execute(function ( r ) {
	//working with a response
});
//or
var createRequest_0 = new COSA.Request.Create(contact_0);
COSA.Core.Execute(createRequest_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_delete_0}
!! Delete message
Delete message
!!! Constructor
!!!! new COSA.Request.Delete(logicalName, id, requestId)
|| Param || Type || Description ||
| logicalName | {{string}} | Entity logical name |
| id | {{string}} | Entity to delete unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Instance Properties
|| Name || Type || Description ||
| logicalName | {{string}} | Entity logical name |
| id | {{string}} | Guid-like string as Entity unique identifier |
| requestId _(optional)_ | {{string}} | Guid-like string as Request unique identifier |
!!! Example
{code:javascript}
(new COSA.Request.Delete('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'))
    .execute(function ( r ) {
       //Working with a response
    });
//or
var deleteRequest_0 = new COSA.Request.Delete('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
COSA.Core.Execute(deleteRequest_0, function ( r ) {
	//Working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_disassociate_0}
!! Disassociate message
!!! Constructor
!!!! new COSA.Request.Disassociate(relationshipSchemaName, target, relatedEntities, requestId)
|| Param || Type || Description ||
| relationshipSchemaName | {{string}} | RelationshipSchemaName |
| target | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Target |
| relatedEntities | Array.<[COSA.EntityReference|COSA Namespace#lib_entityreference_0]> | Related Entities |
| requestId _*(optional)*_ | {{string}} | Request unique identifier (GUID) |
!!! Instance Properties
|| Name || Type || Description ||
| relationshipSchemaName | {{string}} | RelationshipSchemaName |
| target | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Target |
| relatedEntities | Array.<[COSA.EntityReference|COSA Namespace#lib_entityreference_0]> | Related Entities |
!!! Example
{code:javascript}
var disassociate_0 = new COSA.Request.Disassociate('contactleads_association',
        new COSA.EntityReference('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'),
        [
            new COSA.EntityReference('lead', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'),
            new COSA.EntityReference('lead', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
        ]
    );

//message execution
disassociate_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Core.Execute(disassociate_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_executemultiple_0}
!! ExecuteMultiple message
!!! Constructor
!!!! new COSA.Request.ExecuteMultiple(requests, settings, requestId)
|| Param || Type || Description ||
| requests | {{COSA.OrganizationRequestCollection}} | Requests collection |
| settings | [COSA.ExecuteMultipleSettings|COSA Namespace#lib_executemultiplesettings_0] | ExecuteMultiple request settings  |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type ||
| requests | {{COSA.OrganizationRequestCollection}} |
| settings | [COSA.ExecuteMultipleSettings|COSA Namespace#lib_executemultiplesettings_0] |
| requestId _(optional)_ | {{string}} |
!!! Example
{code:javascript}
var be_0 = new COSA.BusinessEntity("contact", null, {
		firstname: 'Michael',
		lastname: 'Jackson',
		primaryemail:'mjackson@mail.com'}),
    createRq = new COSA.Request.Create(be_0),
    deleteRq = new COSA.Request.Delete('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'),
    execMultRqs = new COSA.OrganizationRequestCollection([createRq, deleteRq]),
    execMultSett = new COSA.ExecuteMultipleSettings(true, false),
    execMultRq = new COSA.Request.ExecuteMultiple(execMultRqs, execMultSett);

//message execution
execMultRq.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(execMultRq, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_executeworkflow_0}
!! ExecuteWorkflow message
!!! Constructor
!!!! new COSA.Request.ExecuteWorkflow(workflowId, entityId, requestId)
|| Param || Type || Description ||
| workflowId | {{string}} | Workflow unique identifier (GUID) |
| entityId | {{string}} | Entity unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| workflowId | {{string}} | Workflow unique identifier (GUID) |
| entityId | {{string}} | Entity unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var workflowId = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
    entityId = 'YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY',
    executeWorkflow_0 = new COSA.Request.ExecuteWorkflow(workflowId, entityId);

//message execution
executeWorkflow_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(executeWorkflow_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_loseopportunity_0}
!! LoseOpportunity message
!!! Constructor
!!!! new COSA.Request.LoseOpportunity(opportunityClose, status, requestId)
|| Param || Type || Description ||
| opportunityClose | [COSA.BusinessEntity|COSA Namespace#lib_businessentity_0] | Opportunity Close Entity |
| status | {{number}} | Status |
| requestId _(optional)_ | {{string}} | Request Unique Identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| opportunityClose | [COSA.BusinessEntity|COSA Namespace#lib_businessentity_0] | Opportunity Close Entity |
| status | {{number}} | Status |
| requestId _(optional)_ | {{string}} | Request Unique Identifier (GUID) |
!!! Example
{code:javascript}
var be = new COSA.BusinessEntity('opportunityclose', null, {
        'opportunityid': new COSA.EntityReference('opportunity', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
    });
var loseOpportunity_0 = new COSA.Request.LoseOpportunity(be, 4);

//message execution
loseOpportunity_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(loseOpportunity_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_qualifylead_0}
!! QualifyLead message
!!! Constructor
!!!! new COSA.Request.QualifyLead(lead, createAccount, createContact, createOpportunity, status, requestId)
|| Param || Type || Description ||
| lead | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Lead |
| createAccount | {{boolean}} | Create Account |
| createContact | {{boolean}} | Create Contact |
| createOpportunity | {{boolean}} | Create Opportunity |
| status | {{number}} | Lead Status |
| requestId _(optional)_ | {{string}} | Request Unique Identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| lead | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Lead |
| createAccount | {{boolean}} | Create Account |
| createContact | {{boolean}} | Create Contact |
| createOpportunity | {{boolean}} | Create Opportunity |
| status | {{number}} | Lead Status |
| sourceCampaignId | {{string}} | Source Campaign unique identifier (GUID) |
| opportunityCurrencyId | {{string}} | Opportunity Currency unique identifier (GUID) |
| opportunityCustomerId | {{string}} | Opportunity Customer unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request Unique Identifier (GUID) |
!!! Example
{code:javascript}
var qualifyLead_0 = new COSA.Request.QualifyLead(
		new COSA.EntityReference('lead', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'),
        true,
        true,
        false,
        3);

//message execution
qualifyLead_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(qualifyLead_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_removememberlist_0}
!! RemoveMemberList message
!!! Constructor
!!!! new COSA.Request.RemoveMemberList(listId, entityId, requestId)
|| Param || Type || Description ||
| listId | {{string}} | List unique identifier (GUID) |
| entityId | {{string}} | Entity unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| listId | {{string}} | List unique identifier (GUID) |
| entityId | {{string}} | Entity unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var removeMemberList_0 = new COSA.Request.RemoveMemberList(
        'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
        'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
    );
//message execution
removeMemberList_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(removeMemberList_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_retrieve_0}
!! Retrieve message
Retrieve message
!!! Constructor
!!!! new COSA.Request.Retrieve(logicalName, id, columnSet, requestId)
|| Param || Type || Description ||
| logicalName | {{string}} | Entity Logical Name |
| id | {{string}} | Entity Unique Identifier |
| columnSet | {{Array.<string>}} | Requested columns |
| requestId _(optional)_ | {{string}} | Unique Request Identifier |
!!! Instance Properties
|| Name || Type || Description ||
| logicalName | {{string}} | Entity Logical Name |
| id | {{string}} | Entity Unique Identifier |
| columnSet | {{Array.<string>}} | Requested columns |
| requestId _(optional)_ | {{string}} | Unique Request Identifier |
!!! Example
{code:javascript}
var retrieve_0 = new COSA.Request.Retrieve('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
    [ 'fullname',
    	'birthdate',
        'emailaddress1',
        'creditlimit',
        'numberofchildren',
        'creditonhold',
        'parentcustomerid',
        'gendercode',
        'address1_latitude'
    ]);
//message execution
retrieve_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Core.Execute(retrieve_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_retrieveallentities_0}
!! RetrieveAllEntities message
!!! Constructor
!!!! new COSA.Request.RetrieveAllEntities(filters, retrieveAsIfPublished, requestId)
|| Param || Type || Description ||
| filters | [COSA.EntityFilters|COSA Namespace#lib_entityfilters_0] | Entity Filters |
| retrieveAsIfPublished | {{boolean}} | Retrieve As If Published |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| entityFilters | [COSA.EntityFilters|COSA Namespace#lib_entityfilters_0] | EntityFilters |
| retrieveAsIfPublished | {{boolean}} | Retrieve As If Published |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var retrieveAllEntities_0 = new COSA.Request.RetrieveAllEntities(COSA.Const.EntityFilters.Attributes, true);
//message execution
retrieveAllEntities_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(retrieveAllEntities_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_retrieveattribute_0}
!! RetrieveAttribute message
!!! Constructor
!!!! new COSA.Request.RetrieveAttribute(entityLogicalName, attrLogicalName, retrieveAsIfPublished, requestId)
|| Param || Type || Description ||
| entityLogicalName | {{string}} | Entity Logical Name |
| attrLogicalName | {{string}} | Attribute LogicalName |
| retrieveAsIfPublished | {{boolean}} | Retrieve As If Published |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| entityLogicalName | {{string}} | Entity Logical Name |
| attributeLogicalName | {{string}} | Attribute Logical Name |
| retrieveAsIfPublished | {{boolean}} | Retrieve As If Published |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var retrieveAttribute_0 = new COSA.Request.RetrieveAttribute('contact', 'creditlimit', true);
//message execution
retrieveAttribute_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(retrieveAttribute_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_retrieveentity_0}
!! RetrieveEntity message
!!! Constructor
!!!! new COSA.Request.RetrieveEntity(logicalName, filters, retrieveAsIfPublished, requestId)
|| Param || Type || Description ||
| logicalName | {{string}} | Entity logical name |
| filters | [COSA.EntityFilters|COSA Namespace#lib_entityfilters_0] | Entity filters |
| retrieveAsIfPublished | {{boolean}} | Retrieve As If Published |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| logicalName | {{string}} | Entity Logical Name |
| entityFilters | [COSA.EntityFilters|COSA Namespace#lib_entityfilters_0] | EntityFilters |
| retrieveAsIfPublished | {{boolean}} | Retrieve As If Published |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var retrieveEntity_0 = new COSA.Request.RetrieveEntity('contact', COSA.Const.EntityFilters.All, true);
//message execution
retrieveEntity_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(retrieveEntity_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_retrievemetadatachanges_0}
!! RetrieveMetadataChanges message
!!! Constructor
!!!! new COSA.Request.RetrieveMetadataChanges(query, clientVersionStamp, deletedMetadataFilters, requestId)
|| Param || Type || Description ||
| query | {{COSA.MetadataFilterExpression}} | Query |
| clientVersionStamp | {{string}} | Client Version Stamp |
| deletedMetadataFilters | [COSA.DeletedMetadataFilters|COSA.Const Namespace#enum_deletedmetadatachanges_0] | Deleted Metadata Filters |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| query | {{COSA.MetadataFilterExpression}} | Query |
| clientVersionStamp | {{string}} | Client Version Stamp |
| deletedMetadataFilters | [COSA.DeletedMetadataFilters|COSA.Const Namespace#enum_deletedmetadatachanges_0] | Deleted Metadata Filters |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var subFilterExpression_0 = new COSA.MetadataFilterExpression(COSA.Const.FilterOperator.OR,
        [
            new COSA.MetadataConditionExpression(COSA.Const.MetadataConditionOperator.Equals, 'IsDuplicateDetectionEnabled', new COSA.XrmBoolean(true)),
            new COSA.MetadataConditionExpression(COSA.Const.MetadataConditionOperator.NotEquals, 'IconLargeName', null)
        ]),
        rootFilterExpression_0 = new COSA.MetadataFilterExpression(COSA.Const.FilterOperator.AND,
            [
                new COSA.MetadataConditionExpression(COSA.Const.MetadataConditionOperator.Equals, 'IsCustomEntity', new COSA.XrmBoolean(true))
            ],
            [
                subFilterExpression_0
            ]
        ),
        attributeQuery = new COSA.AttributeQueryExpression(
            new COSA.MetadataFilterExpression(COSA.Const.FilterOperator.AND,
                [
                    new COSA.MetadataConditionExpression(COSA.Const.MetadataConditionOperator.Equals,
                        'Format',
                        new COSA.DateTimeFormat(COSA.Const.DateTimeFormat.DateAndTime))
                ]
            ),
            ['Format', 'LogicalName']
        ),
        entityQueryExpression_0 = new COSA.EntityQueryExpression( rootFilterExpression_0,
            ['LogicalName', 'IconLargeName', 'IsDuplicateDetectionEnabled', 'Attributes', 'OneToManyRelationships'],
            attributeQuery
        ),
        retrieveMetadataChangesRequest_0 = new COSA.Request.RetrieveMetadataChanges(entityQueryExpression_0);

retrieveMetadataChangesRequest_0.execute(function ( resp ) { console.log('RetrieveMetadataChanges'); });

var rootFilterExpression_1 = new COSA.MetadataFilterExpression(COSA.Const.FilterOperator.AND, [
    new COSA.MetadataConditionExpression(COSA.Const.MetadataConditionOperator.Equals, 'IsCustomEntity', new COSA.XrmBoolean(true))
]),
    retrieveMetadataChanges_1 = new COSA.Request.RetrieveMetadataChanges(new COSA.EntityQueryExpression(
        rootFilterExpression_1,
        []
    ), '', COSA.DeletedMetadataFilters(COSA.Const.DeletedMetadataFilters.All));

retrieveMetadataChanges_1.execute(function ( e ) { console.log('retrieveMetadataChanges1'); });
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_retrieveMultiple_0}
!! RetrieveMultiple message
RetrieveMultiple message
!!! Constructor
!!!! new COSA.Request.RetrieveMultiple(queryExpression, requestId)
|| Param || Type || Description ||
| queryExpression | [COSA.QueryExpression|COSA Namespace#lib_queryexpression_0] | Query Expression object |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Instance Properties
|| Name || Type || Description ||
| queryExpression | [COSA.QueryExpression|COSA Namespace#lib_queryexpression_0] | Query Expression object |
!!! Example
{code:javascript}
var fe_0 = new COSA.FilterExpression(COSA.Const.FilterOperator.AND,
        [
            new COSA.ConditionExpression('lastname', COSA.Const.ConditionOperator.Like, [new COSA.XrmString('#%')])
        ]
    ),
    qe_0 = new COSA.QueryExpression('contact', new COSA.ColumnSet(['lastname', 'emailaddress1', 'creditlimit']), fe_0);
qe_0.orders = [
    new COSA.OrderExpression('lastname', COSA.Const.OrderType.Asc),
    new COSA.OrderExpression('firstname', COSA.Const.OrderType.Desc)
];

var retrieveMultiple_0 = new COSA.Request.RetrieveMultiple(qe_0);
//message execution
retrieveMultiple_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Core.Execute(retrieveMultiple_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_retrieveprincipalaccess_0}
!! RetrievePrincipalAccess message
!!! Constructor
!!!! new COSA.Request.RetrievePrincipalAccess(principal, target, requestId)
|| Param || Type || Description ||
| principal | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Principal |
| target | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Target |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| principal | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Principal |
| target | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Target |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var retrievePrincipalAccess_0 = new COSA.Request.RetrievePrincipalAccess(
        new COSA.EntityReference('systemuser', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'),
        new COSA.EntityReference('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
    );

//message execution
retrievePrincipalAccess_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(retrievePrincipalAccess_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_retrieveuserprivileges_0}
!! RetrieveUserPrivileges message
!!! Constructor
!!!! new COSA.Request.RetrieveUserPrivileges(userId, requestId)
|| Param || Type || Description ||
| userId | {{string}} | User unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| userId | {{string}} | User unique identifier (GUID) |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var retrieveUserPrivileges_0 = new COSA.Request.RetrieveUserPrivileges('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
//message execution
retrieveUserPrivileges_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(retrieveUserPrivileges_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_setstate_0}
!! SetState message
!!! Constructor
!!!! new COSA.Request.SetState(entityMoniker, state, status, requestId)
|| Param || Type || Description ||
| entityMoniker | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Entity Moniker |
| state | {{number}} | State |
| status | {{number}} | Status |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Instance Properties
|| Name || Type || Description ||
| entityMoniker | [COSA.EntityReference|COSA Namespace#lib_entityreference_0] | Entity Moniker |
| state | {{number}} | State |
| status | {{number}} | Status |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var setState_0 = new COSA.Request.SetState(new COSA.EntityReference('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'), 1, 2);
//message execution
setState_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Core.Execute(setState_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_update_0}
!! Update message
Update message
!!! Constructor
!!!! new COSA.Request.Update(entity, requestId)
|| Param || Type || Description ||
| entity | [COSA.BusinessEntity|COSA Namespace#lib_businessentity_0] | Entity to update |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Instance Properties
|| Name || Type || Description ||
| entity | [COSA.BusinessEntity|COSA Namespace#lib_businessentity_0] | Entity |
!!! Example
{code:javascript}
var contact_1 = new COSA.BusinessEntity('contact', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
contact_1.attributes.creditlimit = new COSA.XrmMoney(500.14);
contact_1.attributes.numberofchildren = new COSA.XrmWholeNumber(3);
contact_1.attributes.creditonhold = new COSA.XrmBoolean(false);
contact_1.attributes.gendercode = new COSA.OptionSetValue(2);
contact_1.attributes.birthdate = new COSA.XrmDateTime(new Date());
contact_1.attributes.address1_latitude = new COSA.XrmDouble(15.55);

var updateRequest_0 = new COSA.Request.Update(contact_1);
//message execution
updateRequest_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Core.Execute(updateRequest_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]
{anchor:msg_winopportunity_0}
!! WinOpportunity message
!!! Constructor
!!!! new COSA.Request.WinOpportunity(opportunityClose, status, requestId)
|| Param || Type || Description ||
| opportunityClose | [COSA.BusinessEntity|COSA Namespace#lib_businessentity_0] | Opportunity Close Entity |
| status | {{number}} | Opportunity Status |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Properties
|| Name || Type || Description ||
| opportunityClose | [COSA.BusinessEntity|COSA Namespace#lib_businessentity_0] | Opportunity Close Entity |
| status | {{number}} | Opportunity Status |
| requestId _(optional)_ | {{string}} | Request unique identifier (GUID) |
!!! Example
{code:javascript}
var be = new COSA.BusinessEntity('opportunityclose', null, {
        'opportunityid': new COSA.EntityReference('opportunity', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
    });
var winOpportunity_0 = new COSA.Request.WinOpportunity(be, 2);

//message execution
winOpportunity_0.execute(function ( r ) {
	//working with a response
});
//or
COSA.Request.Execute(winOpportunity_0, function ( r ) {
	//working with a response
});
{code:javascript}

[Back to Top|#tbl_contents_0]